[求救!]关于LINUX SHELL脚本

来源:百度知道 编辑:UC知道 时间:2024/05/23 01:24:39
编写SHELL脚本:
1、从用户处获取10个数,显示其中的第3,6,9个数字

2、从用户处获取10个数,显示其中最小的数

请达人帮忙编下

你要哪种Shell?
第一个程序
bash:
if [$# -eq 10];then
echo "The 3rd number is $3"
echo "The 6th number is $6"
echo "The 9th number is $9"
else
echo "Illegal number of parameters"
fi

tcsh
!# /bin/tcsh
if ($# == 10)then
echo "The 3rd number is $3"
echo "The 6th number is $6"
echo "The 9th number is $9"
else
echo "Illegal number of parameters"
endif

第二个程序
bash:
min=$1
if [$# -eq 10];then
for para in $*
do
if [$para -lt $min];then
$min=$para
fi
done
else
echo "Illegal number of parameters"
fi

tcsh:
!# /bin/tcsh
min=$1
if ($# == 10) then
foreach para in ($*)
if ($para < $min) then
$min=$para
endif
end
else
echo "Illegal numb